-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(*): add gosec #94
Conversation
btcclient/query.go
Outdated
@@ -34,7 +38,11 @@ func (c *Client) GetBlockByHash(blockHash *chainhash.Hash) (*types.IndexedBlock, | |||
} | |||
|
|||
btcTxs := types.GetWrappedTxs(mBlock) | |||
return types.NewIndexedBlock(int32(blockInfo.Height), &mBlock.Header, btcTxs), mBlock, nil | |||
height := blockInfo.Height | |||
if height < 0 || height > int64(^uint32(0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems a bit overkill and removing this check and running make gosec-local
does not errors 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will clean cache and try again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap, for me it doesn't appear the error
$~ make gosec-local
Results:
Summary:
Gosec : 2.20.0
Files : 90
Lines : 10303
Nosec : 5
Issues : 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you do any other configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, I was on a "dev" version. Fixed, thanks @RafilxTenfen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah now the CI fails, so seems that we do need it, as our CI used the latest version. I'll be reverting this code then. And you should upgrade to latest version of gosec (2.21.4).
Summary:
Gosec : dev
Files : 90
Lines : 10287
Nosec : 5
Issues : 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.21.4
And try again @RafilxTenfen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
@@ -37,6 +37,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
|
|||
## Unreleased | |||
|
|||
* [#94](https://github.com/babylonlabs-io/vigilante/pull/94) adds gosec and fixes gosec issues | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line
config/submitter.go
Outdated
if cfg.PollingIntervalSeconds < 0 { | ||
return errors.New("invalid polling-interval-seconds, should not be less than 0") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if cfg.PollingIntervalSeconds < 0 { | |
return errors.New("invalid polling-interval-seconds, should not be less than 0") | |
} | |
if cfg.PollingIntervalSeconds <= 0 { | |
return errors.New("invalid polling-interval-seconds, should be positive") | |
} |
@@ -143,6 +144,9 @@ func (m *Monitor) Start(baseHeight uint32) { | |||
} else if !exists { | |||
startHeight = baseHeight | |||
} else { | |||
if dbHeight > math.MaxUint32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems in some places we use math.MaxUint32
and in other places we use ^uint32(0)
. Are they the same? If so, should we keep using one?
Adds gosec